<template>
	<view class="mynews">

		<template v-if="list.length ==  0">
			<notFoundData />
		</template>
		<template v-else>
			<template v-for="item in list">
			<view class="mybox" >
				<view class="mybox_left">
					<avatar :name="item.userName" size="big" />
				</view>
				<view class="mybox_right">
					<view class="mybox_right_top overflow-ellipsis">{{item.userName}}</view>
					<view class="mybox_right_middle overflow-ellipsis">{{item.lastMsg}}</view>
				</view>
			</view>
			</template>
		</template>
	</view>
</template>

<script>
	import avatar from '@/components/common/avatar/index.vue'
	import notFoundData from '@/components/notFoundData/index.vue'
	export default {
		components: {
			notFoundData,
			avatar
		},
		data() {
			return {
				list: []
			}
		},
		methods: {

		},
		async created() {
			console.log(56163);
			try {

				const result = await this.$mjcrequest.request({
					url: this.$api.getAllChat,
					header: this.$aplsjsonheader,
					method: 'GET'
				});
				this.list = result
			} catch (e) {
				this.$errMessageToast(e)
				//TODO handle the exception
			}
		}
	}
</script>

<style lang="less" scoped>
	.mynews {
		padding: 0 15rpx;
		background-color: #fdfdfd;
		padding-bottom: 20rpx;

		.mybox {
			height: 80rpx;
			margin: 15rpx 0;
			display: flex;

			&_right {
				// flex: 1;
				max-width: 80%;;
				padding: 0 8px;
				&_top{
					font-size: 30rpx;
					font-weight: 600;
				}
				&_middle{
					font-size: 24rpx;
					color: #999999;
				}
			}
		}
	}
</style>
